package org.corey.share.business;

import java.util.List;

import javax.persistence.EntityManager;

import org.corey.share.db.entity.CoreyFile;
import org.corey.share.db.manager.EM;

public class NoPageAction {
	public String execute() throws Exception{
		EntityManager em=EM.getEntityManager();
		List<CoreyFile> articles=em.createQuery("SELECT FROM CoreyFile a WHERE a.serverSideFileName=:serverSideFileName and a.user=:user").setParameter("user", 148275).setParameter("serverSideFileName", "0afedef3780e430cb272f7ba2822fd61").getResultList();
		System.out.println(articles.size());
		for(CoreyFile a:articles){
			System.out.println(a.getId());
		}
//		EM.commitTransaction();
//		Article a=new ArticleServiceImpl().loadArticle(45L);
//			System.out.println(a.getTitle());
//			System.out.println(a.getComments().size());
//			for(Comment c:a.getComments()){
//				System.out.println(c.getName());
//			}
//		}
//		EM.beginTransaction();
//		Comment c = new Comment();
//		c.setName("aaaa");
//		articles.get(0).getComments().add(c);
//		em.persist(c);
//		EM.commitTransaction();
//		List<Comment> comments=em.createQuery("SELECT FROM Comment c").getResultList();
//		for(Comment c1:comments){
//			System.out.println(c1.getName());
//		}
//		em.createQuery("DELETE FROM Comment c").executeUpdate();
//		HttpServletResponse response=ServletActionContext.getResponse();
//		response.setContentType("text/html");
//		PrintWriter out=response.getWriter();
//		out.println("HEllo WORL");
		return "NoPage";
	}
}
